-- SuperFind, Copyright by Mac Help Co., January 1988
-- by Chris Hostetter, Mac Help Co., 1800 East Market Street
-- Long Beach, CA 90805, (213) 428-7414
-- The script for this button is copyrighted and may not be
-- used without the written permission of the author (above).
end copyright
on mouseUp
Global LastField, OncePerCard
Global SuperFindName, SearchCommands, Searchstring, SearchStart
Global SearchTimesFound, FindType, OriginalID
get the selection
if it is not empty then put it into SearchString
put the name of the target into SuperFindName
set hilite of SuperFindName to true
put "Chars" into FindType
put empty into SearchLimit
ask "Find Word(s)? Hold option key for limits." with SearchString
set hilite of SuperFindName to false
if it is empty then
put 0 into searchtimesfound
exit mouseUp
end if
put it into SearchString
if SearchString is "Date" then
--answer "Find the word 'Date' or Enter a Date?" with "Find Word" or "Enter"
put "Enter" into it
if it is "Enter" then
put the short date into it
ask "Enter date you wish to find? I.e. (0/0/00)" & Return & Return & "Today's Date is: " && the long date with it
if it is empty then exit mouseUp
put it into SearchString
answer "Search for '" & SearchString & "' in what format?" with "Seconds" or "Long Date" or "Short Date"
put it into DateType
if SearchString contains "T" then
put the short date into SearchString
end if
if DateType is "Seconds" then convert SearchString to Seconds
if DateType is "Long Date" then convert SearchString to Long Date
if DateType is "Short Date" then convert SearchString to Short Date
end if
end if
put false into OncePerCard
if the OptionKey is down then
if LastField is not empty then
put LastField into ShortLastField
delete word 1 of ShortLastField
delete word 1 of ShortLastField
Answer "Search for information in what field?" with "Cancel" or ShortLastField or "Any Field"
if it is "Cancel" Then
exit mouseUp
end if
if it is ShortLastField then
put " in " & LastField into SearchLimit
else
put "" into SearchLimit
end if
end if
Answer "Find " & FindType & " '" & Searchstring & "'" with "Begins With" or "Full Word" or "These Chars"
if it is "Begins with" then put empty into FindType
if it is "Full Word" then put "Word" into FindType
if it is "These Chars" then put "Chars" into FindType
answer "Find string only one time per card?" with "1 per card" or "ALL"
if it is "1 per card" then put true into OncePerCard
end if -- the optionKey segment
put "Find" && FindType && Quote & SearchString & Quote & SearchLimit into SearchCommands
set loc of message box to 20,-50
put "Send DoSearch to" && SuperFindName into the message box
hide message box
set loc of message box to 20,300
put the ID of this Card into OriginalID
put 0 into SearchTimesFound
do message box
end mouseUp
on "DoSearch"
Global SuperFindName, SearchCommands, Searchstring, SearchStart
Global SearchTimesFound, FindType, LastCardID, ManyCards, OriginalID
Global OncePerCard
if SearchTimesFound is 0 then
-- initialize variables
put False into ManyCards
put the ID of this card into LastCardID
end if
if OncePerCard is true then go to next card
do SearchCommands
if the result is "Not Found" then
beep
put 0 into SearchTimesFound
answer "Can't Find:" && FindType && "'" & SearchString & "'" with "Cancel" or "Re-Search"
if it is "Re-Search" then click at the loc of SuperFindName
exit "DoSearch"
end if
-- IF IT HAS GONE THIS FAR, AT LEAST ONE OCCOURANCE
-- HAS ALREADY BEEN FOUND!
if SearchTimesFound is 0 then
put the ID of this card into SearchStart
put the ID of this card into LastCardID
end if
if the ID of this card is not LastCardID then
put True into ManyCards
put the ID of this card into LastCardID
end if
if ManyCards is True and SearchTimesFound > 0 then
if the ID of this card is SearchStart then
beep
wait 60
if the ID of this card is not OriginalID then
answer SearchTimesFound && "Occourance(s) of" && FindType && "'" & SearchString & "'" with "Return" or "Cancel" or "Re-Search"
else
answer SearchTimesFound && "Occourance(s) of" && FindType && "'" & SearchString & "'" with "Cancel" or "Re-Search"
end if
if it is "Re-Search" then click at the loc of SuperFindName
if it is "Return" then go to OriginalID
put 0 into SearchTimesFound
exit "DoSearch"
end if
end if
add 1 to SearchTimesFound
end "DoSearch"
-- part 2 (field)
-- low flags: 00
-- high flags: 2002
-- rect: left=278 top=89 right=164 bottom=501
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name:
----- HyperTalk script -----
on openField
-- use the openField command on unlocked fields
Global LastField
put the name of the target into LastField
end openField
-- part 3 (field)
-- low flags: 01
-- high flags: 2002
-- rect: left=278 top=171 right=274 bottom=501
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name:
----- HyperTalk script -----
on mouseUp
-- use the mouseUp command on locked fields
Global LastField
put the name of the target into LastField
visual effect wipe down
go to this card
end mouseUp
-- part 5 (field)
-- low flags: 01
-- high flags: 0004
-- rect: left=320 top=23 right=38 bottom=380
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: See Script
----- HyperTalk script -----
on mouseUp
edit script of card button ID 1
end mouseUp
-- part 6 (field)
-- low flags: 01
-- high flags: 0004
-- rect: left=447 top=79 right=94 bottom=507
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: See Script
----- HyperTalk script -----
on mouseUp
edit script of card field ID 2
end mouseUp
-- part 7 (field)
-- low flags: 01
-- high flags: 0004
-- rect: left=452 top=166 right=181 bottom=512
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: See Script
----- HyperTalk script -----
on mouseUp
edit script of card field ID 3
end mouseUp
-- part contents for background part 8
----- text -----
Card 19 of 20
-- part contents for background part 9
----- text -----
SUPERFIND BUTTON
This find button is very powerful. Once you click on it and enter your search criteria, to continue with the search simply hit the RETURN or ENTER button each time. When it has shown all the cards that meet your search criteria, it will tell you it is finished and the number of occourances found. It may even show a button titled 'Return' which will take you back to the card you started on when you first clicked the SuperFind button.
if you hilight some text (with the browsing tool) and then click the superFind button, it will put that string in for you. If you enter the word DATE, you can find the word or a date in several different formats
OPTION KEY Limits
If you hold the option key down while clicking OK you can be more specific. And if you put the name of any background field into the global variable 'LastField', you can limit the search to that specific field.
-- part contents for card part 2
----- text -----
Field 1. The script of this field says to put the name of this field into the variable 'LastField', as soon as you click IN this field.
-- part contents for card part 3
----- text -----
Field 2. (A locked field). The script of this field says to put the name of this field into the variable 'LastField', as soon as you click ON this field.